package com.lagou.edu.controller;

import com.lagou.edu.pojo.Position;
import com.lagou.edu.service.PositionService;
import org.apache.solr.client.solrj.SolrServerException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.io.IOException;
import java.util.List;

@Controller
public class PositionController {
    @Autowired
    PositionService positionService;

    @RequestMapping("/query")
    public String queryPositions(String positionName, Model model) throws IOException, SolrServerException {
        List<Position> positions = positionService.queryPositions(positionName);
        model.addAttribute("list", positions);
        return "index";
    }
}
